package com.ym.pms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ym.pms.dao.SysUserDao;
import com.ym.pms.model.SysAuth;
import com.ym.pms.model.SysRole;
import com.ym.pms.model.SysUser;
import com.ym.pms.service.SysUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: xybh
 * @Description:
 * @Date: Created in 0:44 2020/12/21
 * @Modified:
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUser> implements SysUserService {

    @Override
    public SysUser findUserByUserId(Long userId) {
        return this.baseMapper.selectOne(
                new QueryWrapper<SysUser>().lambda().eq(SysUser::getUId, userId).ne(SysUser::getUStatus, "1")
        );
    }

    @Override
    public List<SysRole> findRoleByUserId(Long userId) {
        return this.baseMapper.findRoleByUserId(userId);
    }

    @Override
    public List<SysAuth> findAuthByUserId(Long userId) {
        return this.baseMapper.findAuthByUserId(userId);
    }
}
